package org.plex.task.imp;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.plex.attachement.AttachmentInfo;
import org.plex.attachement.imp.AttachmentInfoImp;
import org.plex.core.imp.TaskACLImp;
import org.plex.model.ImageTicket;
import org.plex.model.TaskACL;
import org.plex.model.imp.ImageTicketImp;
import org.plex.task.FormInstance;
import org.plex.task.ParticipantInfo;
import org.plex.task.TaskInfo;
import org.plex.task.TaskTimerInfo;

import com.adobe.idp.taskmanager.dsc.client.task.FormInstanceImpl;
import com.adobe.idp.taskmanager.dsc.client.task.TaskACLImpl;

public class TaskInfoImp implements TaskInfo, Serializable {
	private static final long serialVersionUID = -915073651606630296L;
	private com.adobe.idp.taskmanager.dsc.client.task.TaskInfo taskInfo;

	public TaskInfoImp(com.adobe.idp.taskmanager.dsc.client.task.TaskInfo info)
			throws NullPointerException {
		if (null == info) {
			throw new NullPointerException();
		}
		this.taskInfo = info;
	}

	public long getActionId() {
		// TODO Auto-generated method stub
		return taskInfo.getActionId();
	}

	public long getActionInstanceid() {
		// TODO Auto-generated method stub
		return taskInfo.getActionInstanceId();
	}

	public ParticipantInfo getAssignedTo() {
		// TODO Auto-generated method stub
		ParticipantInfo info = new ParticipantInfoImp(taskInfo.getAssignedTo());
		return info;
	}

	public Date getAssignmentCreateTime() {
		// TODO Auto-generated method stub
		return this.taskInfo.getAssignmentCreateTime();
	}

	public short getAssignmentStatus() {
		// TODO Auto-generated method stub
		return this.taskInfo.getAssignmentStatus();
	}

	public short getAssignmentSubStatus() {
		// TODO Auto-generated method stub
		return this.getAssignmentSubStatus();
	}

	public short getAssignmentType() {
		// TODO Auto-generated method stub
		return this.taskInfo.getAssignmentType();
	}

	public Date getAssignmentUpdateTime() {
		// TODO Auto-generated method stub
		return this.taskInfo.getAssignmentUpdateTime();
	}

	public List<? extends AttachmentInfo> getAttachments() {
		// TODO Auto-generated method stub
		com.adobe.idp.taskmanager.dsc.client.task.AttachmentInfo[] attachmentInfos = taskInfo
				.getAttachments();
		int length = attachmentInfos.length;
		List<AttachmentInfo> list = new ArrayList<AttachmentInfo>();
		for (com.adobe.idp.taskmanager.dsc.client.task.AttachmentInfo attachmentInfo : attachmentInfos) {
			AttachmentInfo e = new AttachmentInfoImp(attachmentInfo);
			list.add(e);
		}
		return list;
	}

	public String getConsultGroupid() {
		// TODO Auto-generated method stub
		return taskInfo.getConsultGroupId();
	}

	public Date getCreateTime() {
		// TODO Auto-generated method stub
		return taskInfo.getCreateTime();
	}

	public long getCurrentAssignmentId() {
		// TODO Auto-generated method stub
		return taskInfo.getCurrentAssignmentId();
	}

	@Deprecated
	public Date getDeadline() {
		// TODO Auto-generated method stub
		return taskInfo.getDeadline();
	}

	public TaskTimerInfo getDeadlineInfo() {
		// TODO Auto-generated method stub
		return new TaskTimerInfoImp(taskInfo.getDeadlineInfo());
	}

	public TaskACL getDefaultkACLs() {
		// TODO Auto-generated method stub
		return new TaskACLImp(taskInfo.getDefaultACLs());
	}

	public String getDescription() {
		// TODO Auto-generated method stub
		return taskInfo.getDescription();
	}

	public TaskTimerInfo getEscalationInfo() {
		// TODO Auto-generated method stub
		return new TaskTimerInfoImp(taskInfo.getEscalationInfo());
	}

	public TaskTimerInfo getFirstReminderInfo() {
		// TODO Auto-generated method stub
		return new TaskTimerInfoImp(taskInfo.getFirstReminderInfo());
	}

	public String getForwardGroupId() {
		// TODO Auto-generated method stub
		return taskInfo.getForwardGroupId();
	}

	public ImageTicket getImageTicket() {
		// TODO Auto-generated method stub
		return new ImageTicketImp(taskInfo.getImageTicket());
	}

	public String getInstructions() {
		// TODO Auto-generated method stub
		return taskInfo.getInstructions();
	}

	public long getNumForms() {
		// TODO Auto-generated method stub
		return taskInfo.getNumForms();
	}

	public long getNumFormsToBeSaved() {
		// TODO Auto-generated method stub
		return taskInfo.getNumFormsToBeSaved();
	}

	public ParticipantInfo getOOODesignatedFor() {
		// TODO Auto-generated method stub
		return new ParticipantInfoImp(taskInfo.getOOODesignatedFor());
	}

	public short getPriority() {
		// TODO Auto-generated method stub
		return taskInfo.getPriority();
	}

	public long getProcessInstanceId() {
		// TODO Auto-generated method stub
		return taskInfo.getProcessInstanceId();
	}

	public String getProcessName() {
		// TODO Auto-generated method stub
		return taskInfo.getProcessName();
	}

	public long getReminderCount() {
		// TODO Auto-generated method stub
		return taskInfo.getReminderCount();
	}

	public TaskTimerInfo getRepeatReminderInfo() {
		// TODO Auto-generated method stub
		return new TaskTimerInfoImp(taskInfo.getRepeatReminderInfo());
	}

	public List<String> getRouteList() {
		// TODO Auto-generated method stub
		String[] strings = taskInfo.getRouteList();
		List<String> list = new ArrayList<String>();
		for (String string : strings) {
			list.add(string);
		}
		return list;
	}

	public boolean getRouteSelectionRequired() {
		// TODO Auto-generated method stub
		return taskInfo.getRouteSelectionRequired();
	}

	public String getSelectedRoute() {
		// TODO Auto-generated method stub
		return taskInfo.getSelectedRoute();
	}

	public String getStepName() {
		// TODO Auto-generated method stub
		return taskInfo.getStepName();
	}

	public List<TaskACL> getTaskACLs() {
		// TODO Auto-generated method stub
		com.adobe.idp.taskmanager.dsc.client.task.TaskACL[] taskACLs = taskInfo.getTaskACLs();
		List<TaskACL> list = new ArrayList<TaskACL>();
		for (com.adobe.idp.taskmanager.dsc.client.task.TaskACL taskACL : taskACLs) {
			list.add(new TaskACLImp(taskACL));
		}
		return list;
	}

	public long getTaskId() {
		// TODO Auto-generated method stub
		return taskInfo.getTaskID();
	}

	public List<FormInstance> getTaskItems() {
		// TODO Auto-generated method stub
		com.adobe.idp.taskmanager.dsc.client.task.FormInstance[] formInstances = taskInfo.getTaskItems();
		List<FormInstance> list = new ArrayList<FormInstance>();
		for (com.adobe.idp.taskmanager.dsc.client.task.FormInstance formInstance : formInstances) {

			list.add(new FormInstanceImp(formInstance));
		}
		return list;
	}

	public short getTaskStatus() {
		// TODO Auto-generated method stub
		return taskInfo.getTaskStatus();
	}

	public Date getUpdateTime() {
		// TODO Auto-generated method stub
		return taskInfo.getUpdateTime();
	}

	public Date getnextReminder() {
		// TODO Auto-generated method stub
		return taskInfo.getNextReminder();
	}

	public boolean isLocked() {
		// TODO Auto-generated method stub
		return taskInfo.isLocked();
	}

	public boolean isOutOfOfficeEligible() {
		// TODO Auto-generated method stub
		return taskInfo.isOutOfOfficeEligible();
	}

	public boolean isStartTask() {
		// TODO Auto-generated method stub
		return taskInfo.isStartTask();
	}

	public boolean isVisible() {
		// TODO Auto-generated method stub
		return taskInfo.isVisible();
	}

	public boolean showAttachments() {
		// TODO Auto-generated method stub
		return taskInfo.showAttachments();
	}

	public void addACLsForSharedQueues(boolean isAddACLsForSharedQueues) {
		// TODO Auto-generated method stub
		taskInfo.addACLsForSharedQueues(isAddACLsForSharedQueues);
	}

	@Deprecated
	public void copyAttachments(boolean isCopyAttachments) {
		// TODO Auto-generated method stub
		taskInfo.copyAttachments(isCopyAttachments);

	}

	public void isStartTask(boolean isStartTask) {
		// TODO Auto-generated method stub
		taskInfo.isStartTask(isStartTask);
	}

	public void setActionId(long actionId) {
		// TODO Auto-generated method stub
		taskInfo.setActionId(actionId);
	}

	public void setAssignTo(ParticipantInfo participantInfo) {
		ParticipantInfoImp imp = (ParticipantInfoImp) participantInfo;
		taskInfo.setAssignTo(imp.getParticipantInfo());

	}

	public void setAttachmentDocumentList(List attachmentDocumentList) {
		// TODO Auto-generated method stub
		taskInfo.setAttachmentDocumentList(attachmentDocumentList);
	}

	public void setDeadlineInfo(TaskTimerInfo taskTimerInfo) {
		// TODO Auto-generated method stub
		TaskTimerInfoImp imp = (TaskTimerInfoImp) taskTimerInfo;
		taskInfo.setDeadlineInfo(imp.getTaskTimerInfo());

	}

	public void setDeadlineInstructions(String instructions) {
		// TODO Auto-generated method stub
		taskInfo.setDeadlineInstructions(instructions);

	}

	public void setDeadlineRouteName(String routeName) {
		// TODO Auto-generated method stub
		taskInfo.setDeadlineRouteName(routeName);
	}

	public void setDecription(String description) {
		// TODO Auto-generated method stub

		taskInfo.setDescription(description);

	}

	public void setDefaultACLs(TaskACL taskACL) {
		// TODO Auto-generated method stub
		TaskACLImp imp = (TaskACLImp) taskACL;
		taskInfo.setDefaultACLs(imp.getTaskACL());
	}

	public void setEscalateTo(ParticipantInfo participantInfo) {
		// TODO Auto-generated method stub
		ParticipantInfoImp imp = (ParticipantInfoImp) participantInfo;
		taskInfo.setEscalateTo(imp.getParticipantInfo());
	}

	public void setEscalationInfo(TaskTimerInfo taskTimerInfo) {
		// TODO Auto-generated method stub
		TaskTimerInfoImp imp = (TaskTimerInfoImp) taskTimerInfo;
		taskInfo.setEscalationInfo(imp.getTaskTimerInfo());
	}

	public void setFirstReminderInfo(TaskTimerInfo taskTimerInfo) {
		TaskTimerInfoImp imp = (TaskTimerInfoImp) taskTimerInfo;
		taskInfo.setFirstReminderInfo(imp.getTaskTimerInfo());

	}

	public void setForwardGroup(String services, String groupName) {
		// TODO Auto-generated method stub
		taskInfo.setForwardGroup(services, groupName);
	}

	public void setForwardGroupId(String forwardGroupId) {
		// TODO Auto-generated method stub
		taskInfo.setForwardGroupId(forwardGroupId);

	}

	public void setInstructions(String instructions) {
		// TODO Auto-generated method stub
		taskInfo.setInstructions(instructions);
	}

	public void setLongLivedInvocationId(String longLivedInvocationId) {
		// TODO Auto-generated method stub
		taskInfo.setLongLivedInvocationId(longLivedInvocationId);
	}

	public void setOutOfOfficeEligible(boolean isOutofOffice) {
		// TODO Auto-generated method stub
		taskInfo.setOutOfOfficeEligible(isOutofOffice);

	}

	public void setOutOfOfficeEligibleEscalations(
			boolean isOutOfOfficeEligibleEscalations) {
		// TODO Auto-generated method stub
		taskInfo.setOutOfOfficeEligibleEscalations(isOutOfOfficeEligibleEscalations);
	}

	public void setPriority(short priority) {
		// TODO Auto-generated method stub
		taskInfo.setPriority(priority);
	}

	public void setProcessInstanceId(long processInstanceId) {
		// TODO Auto-generated method stub
		taskInfo.setProcessInstanceId(processInstanceId);
	}

	public void setProcessName(String processName) {
		// TODO Auto-generated method stub
		taskInfo.setProcessName(processName);
	}

	public void setReminderInstructions(String reminderInstructions) {
		// TODO Auto-generated method stub
		taskInfo.setReminderInstructions(reminderInstructions);
	}

	@Deprecated
	public void setReminderRepeatMinutes(long reminderRepeatMinutes) {
		// TODO Auto-generated method stub
		taskInfo.setReminderRepeatMinutes(reminderRepeatMinutes);
	}

	public void setRepeatReminderInfo(TaskTimerInfo taskTimerInfo) {
		// TODO Auto-generated method stub
		TaskTimerInfoImp imp = (TaskTimerInfoImp) taskTimerInfo;
		taskInfo.setRepeatReminderInfo(imp.getTaskTimerInfo());
	}

	public void setRouteList(List<String> routeList) {
		int size = routeList.size();
		String[] strings = new String[size];
		for (int i = 0; i < size; i++) {
			strings[i] = routeList.get(i);
		}

		taskInfo.setRouteList(strings);

	}

	public void setRouteSelectionRequired(boolean isRequired) {
		// TODO Auto-generated method stub
		taskInfo.setRouteSelectionRequired(isRequired);
	}

	public void setSelectedRoute(String selectedRoute) {
		// TODO Auto-generated method stub
		taskInfo.setSelectedRoute(selectedRoute);

	}

	public void setStepName(String stepName) {
		// TODO Auto-generated method stub
		taskInfo.setStepName(stepName);

	}

	public void setTaskACLs(List<TaskACL> taskACLList) {
		// TODO Auto-generated method stub
		int size = taskACLList.size();
		com.adobe.idp.taskmanager.dsc.client.task.TaskACL[] taskACLs = new TaskACLImpl[size];
		for (int i = 0; i < size; i++) {
			TaskACLImp imp = (TaskACLImp) taskACLList.get(i);
			taskACLs[i] = imp.getTaskACL();
		}
		taskInfo.setTaskACLs(taskACLs);
	}

	public void setTaskItems(List<? extends FormInstance> FormInstanceList) {
		// TODO Auto-generated method stub
		int size = FormInstanceList.size();
		com.adobe.idp.taskmanager.dsc.client.task.FormInstance[] formInstances = new FormInstanceImpl[size];
		for (int i = 0; i < size; i++) {
			FormInstanceImp imp = (FormInstanceImp) FormInstanceList.get(i);
			formInstances[i] = imp.getFormInstance();
		}
		taskInfo.setTaskItems(formInstances);
	}

	public void showAttachments(boolean isShowAttachments) {
		// TODO Auto-generated method stub

		this.taskInfo.showAttachments(isShowAttachments);
	}

	public void setTaskInfo(
			com.adobe.idp.taskmanager.dsc.client.task.TaskInfo taskInfo) {
		this.taskInfo = taskInfo;
	}

	public com.adobe.idp.taskmanager.dsc.client.task.TaskInfo getTaskInfo() {
		return taskInfo;
	}

}
